﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace background.Manager.Content.Action {
    /// <summary>
    /// content 的摘要说明
    /// </summary>
    public class content: IHttpHandler {

        public void ProcessRequest(HttpContext context) {
            context.Response.ContentType = "text/plain";
            HttpRequest r=context.Request;
            string ret=string.Empty;
            switch(r["action"].ToString()) {
                case "add":
                    ret= Codes.Content.add(r["group"], r["title"], r["content"], r["order"], r["author"], r["summary"], r["cover"], r["label"]).ToString().ToLower();
                    break;
                case "update":
                    ret= Codes.Content.update(r["id"], r["title"], r["content"], r["order"], r["author"], r["summary"], r["cover"], r["label"]).ToString().ToLower();
                    break;
                case "delete":
                    ret= Codes.Content.deleteMass(r["idList"]).ToString().ToLower();
                    break;
                case "getInfo":
                    ret=Codes.h.getJson(Codes.Content.getInfo(r["id"]));
                    break;
                case "changeOrder":
                    ret= Codes.Content.changeOrder(int.Parse(r["order"]), int.Parse(r["id"])).ToString().ToLower();
                    break;
            }
            context.Response.Write(ret);
        }

        public bool IsReusable {
            get {
                return false;
            }
        }
    }
}